package prototype.simple;



/**
 * Created by IntelliJ
 * Author:熊磊
 */
// Clonable对引用类型实现的是浅拷贝
public class Client {
    public static void main(String[] args) throws CloneNotSupportedException {
        Sheep sheep1 = new Sheep("tom", 1, "white");
        sheep1.friend =new Sheep("jack",2,"black");
        Sheep sheep2 = (Sheep)sheep1.clone();
        Sheep sheep3 = (Sheep)sheep1.clone();
        System.out.println(sheep2.hashCode()); // hashcode不同
        System.out.println(sheep3.hashCode());
        System.out.println(sheep2.friend.hashCode()); //friend相同
        System.out.println(sheep3.friend.hashCode());
    }
}
